<?php 
/**
 * @author Eugenio Fage
 * http://eugeniofage.wordpress.com/
 * http://code.google.com/p/monky/
 * 
 */

if(!$this->Session->check('Auth.User.id')) {
	
    $_login=$this->Html->link(__('Login',true),array('controller'=>'users','action'=>'login'));
    $_register=$this->Html->link(__('register',true),array('controller'=>'users','action'=>'register'));    		
    $message=sprintf(__('You must %s or %s to comment!',true),$_login,$_register).'<br />'. __('Sign-in super fast with your Facebook or Twitter account ...',true);

    echo $this->element('warn',array('message'=>$message));
    echo $this->element('thirdPartyLogin');
	
} elseif(isset($error)&& $error){ 
	echo $this->element('warn',array('message'=>$error));
} else { 
	if(!$link_id) $link_id=null;
	
	echo $this->Form->create('Comment',array('url'=>array('controller'=>'comments','action'=>'addComment',$link_id)));
	echo $this->Form->input('content');
	echo $this->Js->submit('Save', array('update' => '#commentForm',
		'before'=>"$('#commentForm').html('<p>".$this->Html->image('loader.gif')."</p>');",'loaded'=>'$("#commentForm").Loadingdotdotdot("Stop");','div' => false, 'type' => 'json','url'=>array('controller'=>'comments','action'=>'addComment',$link_id)));
	 //'async' => false
	   
	
	echo $this->Form->end();
	
	if(isset($this->Js)) echo $this->Js->writeBuffer();
} ?>
